London | 26-SDC-Mar | Mariia Serhiienko | Sprint 2 | Shell pipelines#440
Open
Konvaly wants to merge 3 commits into
Open
London | 26-SDC-Mar | Mariia Serhiienko | Sprint 2 | Shell pipelines#440Konvaly wants to merge 3 commits into
Konvaly wants to merge 3 commits into
Conversation
cjyuan
reviewed
May 12, 2026
| # The input for this script is the scores-table.txt file. | ||
| # TODO: Write a command to output scores-table.txt, with shows the line for the player whose first score was the second highest. | ||
| # Your output should be: "Piotr Glasgow 15 2 25 11 8" (without quotes). | ||
| sort -k3 -rn scores-table.txt | head -2 | tail -1 No newline at end of file |
There was a problem hiding this comment.
Note:
I was curious and asked AI's which of the following ways of using head and tail is preferred:
head -2 | tail -1head -n 2 | tail -n 1
They suggested the 2nd syntax for compatibility and readability reasons.
| # The input for this script is the events.txt file. | ||
| # TODO: Write a command to show how many times anyone has entered and exited. | ||
| # It should be clear from your script's output that there have been 5 Entry events and 4 Exit events. | ||
| sort events.txt | uniq -c | sort -k2 No newline at end of file |
There was a problem hiding this comment.
The output produced by your command does not quite match the expected output, which is in the form:
5 Entry
4 Exit
| # TODO: Write a command to show how many times anyone has entered and exited. | ||
| # It should be clear from your script's output that there have been 5 Entry events and 4 Exit events. | ||
| # The word "Event" should not appear in your script's output. | ||
| tail -n +2 events-with-timestamps.txt | cut -d' ' -f3 | sort | uniq -c No newline at end of file |
There was a problem hiding this comment.
`cut -d' ' -f3 works only if the fields on each line is separated by EXACTLY one space.
The fields in the given file are separated by a tab key, so the command won't work.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Learners, PR Template
Self checklist
Changelist
Completed tasks with commands ls-grep-sort-uniq-grep-tail-tr